<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import parcelDeclaration from '@/api/document/parcelDeclaration'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()




const options = reactive({
  id: 'parcel_declaration',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  formOption: {
    viewType: 'drawer',
    width: 600
  },
  api: parcelDeclaration.getList,
  recycleApi: parcelDeclaration.getRecycleList,
  add: {
    show: true,
    api: parcelDeclaration.save,
    auth: ['document:parcelDeclaration:save']
  },
  edit: {
    show: true,
    api: parcelDeclaration.update,
    auth: ['document:parcelDeclaration:update']
  },
  delete: {
    show: true,
    api: parcelDeclaration.deletes,
    auth: ['document:parcelDeclaration:delete'],
    realApi: parcelDeclaration.realDeletes,
    realAuth: ['document:parcelDeclaration:realDeletes']
  },
  recovery: {
    show: true,
    api: parcelDeclaration.recoverys,
    auth: ['document:parcelDeclaration:recovery']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "箱号",
    dataIndex: "parcel_id",
    formType: "select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入箱号"
    }
  },
  {
    title: "商品SKU",
    dataIndex: "sku",
    formType: "input",
    search: true
  },
  {
    title: "PO Number",
    dataIndex: "po_number",
    formType: "input",
    search: true
  },
  {
    title: "中文品名",
    dataIndex: "cn_name",
    formType: "input",
    search: true
  },
  {
    title: "英文品名",
    dataIndex: "en_name",
    formType: "input",
    search: true
  },
  {
    title: "申报币种",
    dataIndex: "currency",
    formType: "input",
    search: true
  },
  {
    title: "申报单价",
    dataIndex: "price",
    formType: "input",
    search: true
  },
  {
    title: "数量",
    dataIndex: "quantity",
    formType: "input",
    search: true
  },
  {
    title: "材质",
    dataIndex: "material",
    formType: "input",
    search: true
  },
  {
    title: "用途",
    dataIndex: "purpose",
    formType: "input",
    search: true
  },
  {
    title: "品牌",
    dataIndex: "brand",
    formType: "input",
    search: true
  },
  {
    title: "型号",
    dataIndex: "model",
    formType: "input",
    search: true
  },
  {
    title: "销售价格",
    dataIndex: "sale_price",
    formType: "input",
    search: true
  },
  {
    title: "采购价格",
    dataIndex: "purchase_price",
    formType: "input",
    search: true
  },
  {
    title: "销售链接",
    dataIndex: "sale_url",
    formType: "input",
    search: true
  },
  {
    title: "ASIN",
    dataIndex: "asin",
    formType: "input",
    search: true
  },
  {
    title: "FNSKU",
    dataIndex: "fnsku",
    formType: "input",
    search: true
  },
  {
    title: "重量",
    dataIndex: "weight",
    formType: "input",
    search: true
  },
  {
    title: "尺寸",
    dataIndex: "size",
    formType: "input",
    search: true
  },
  {
    title: "图片链接",
    dataIndex: "image_url",
    formType: "upload",
    type: "image",
    multiple: false
  },
  {
    title: "海关编码",
    dataIndex: "hs_code",
    formType: "input",
    search: true
  },
  {
    title: "税率",
    dataIndex: "tax_rate",
    formType: "input",
    search: true
  },
  {
    title: "品牌类型",
    dataIndex: "brand_type",
    formType: "input",
    search: true
  },
  {
    title: "带电",
    dataIndex: "is_elec",
    formType: "input",
    search: true
  },
  {
    title: "带磁",
    dataIndex: "is_magnetic",
    formType: "input",
    search: true
  },
  {
    title: "电池标号",
    dataIndex: "battery_mark",
    formType: "input",
    search: true
  },
  {
    title: "电池描述",
    dataIndex: "battery_desc",
    formType: "input",
    search: true
  },
  {
    title: "产品标题",
    dataIndex: "product_title",
    formType: "input",
    search: true
  },
  {
    title: "产品描述",
    dataIndex: "product_desc",
    formType: "input",
    search: true
  },
  {
    title: "平台",
    dataIndex: "platform",
    formType: "input",
    search: true
  },
  {
    title: "上架手续费",
    dataIndex: "listing_fee",
    formType: "input",
    search: true
  },
  {
    title: "出库手续费",
    dataIndex: "outbound_fee",
    formType: "input",
    search: true
  },
  {
    title: "单位",
    dataIndex: "unit",
    formType: "input",
    search: true
  },
  {
    title: "产地",
    dataIndex: "origin",
    formType: "input",
    search: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'document:parcelDeclaration' } </script>